<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>readystate</title>
    <script src="js/createXMLHttpRequest对象.js"></script>
</head>
<body>
    <div></div>
    <button class="btn">按钮</button>
    <script>
        var btn = document.getElementsByClassName("btn")[0]
        console.log(btn)
        btn.addEventListener('click',function(){
            var xhr = createXMLHttpRequest();
            xhr.open('get',"https://developer.mozilla.org/")
            xhr.send(null)
            xhr.onreadystatechange = function(){
                console.log(xhr.readyState)
            }
        })
    </script>
</body>
</html>